﻿using System;
using System.Collections.Generic;

namespace CoreRay.Collections
{
    /// <summary>
    /// Collection that organizes data into a tree where each node has 2 children.
    /// </summary>
    /// <typeparam name="T">Type of the data stored in the tree nodes.</typeparam>
    [Serializable]
    public class BinaryTree<T>
    {
        /// <summary>
        /// Initializes a new instance of the BinaryTree class.
        /// </summary>
        public BinaryTree()
        {
        }

        /// <summary>
        /// Gets or sets the root of the binary tree.
        /// </summary>
        /// <value>Root node of the binary tree.</value>
        public BinaryTreeNode<T> Root
        {
            get;
            set;
        }

        /// <summary>
        /// Clears the binary tree and sets the root node to null.
        /// </summary>
        public void Clear()
        {
            this.Root = null;
        }
    }
}
